package jam;

import com.alibaba.fastjson.JSON;
import org.wlld.MatrixTools.Matrix;
import org.wlld.ModelData;
import org.wlld.config.StudyPattern;
import org.wlld.imageRecognition.Operation;
import org.wlld.imageRecognition.Picture;
import org.wlld.imageRecognition.TempleConfig;
import org.wlld.nerveEntity.ModelParameter;

//图片识别
public class PictureTest2 {
    //创建一个静态单例配置模板类
    static TempleConfig templeConfig = new TempleConfig();

    public static void main(String[] args)throws Exception {

        //初始化配置模板
        templeConfig.init(StudyPattern.Accuracy_Pattern, true, 640, 640, 2);
        //将配置模板类作为构造塞入计算类
        Operation operation = new Operation(templeConfig);
        //从数据库中读取学习的模型结果，反序列为ModelParameter
        ModelParameter modelParameter = JSON.parseObject(ModelData.DATA2, ModelParameter.class);
        //将模型数据注入配置模板类
        templeConfig.insertModel(modelParameter);

        Picture picture = new Picture();

        Matrix a = picture.getImageMatrixByLocal("/Users/jianganming/Downloads/a1920.jpg");
        //返回此图片的分类ID
        int an = operation.toSee(a);
        System.out.println(an);
    }
}
